//
//  ViewController.m
//  CalendarView
//
//  Created by 曾墨 on 16/8/23.
//  Copyright © 2016年 YuanJiang. All rights reserved.
//

#import "ViewController.h"
#import "selfdefineCalendarView.h"
@interface ViewController ()

@property(nonatomic,strong) UIButton *freeButton;

@property(nonatomic,strong) UILabel *freeLabel;


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.freeButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.freeButton.frame = CGRectMake(20, 20, 100, 30);
    [self.freeButton setTitle:@"点击" forState:UIControlStateNormal];
    [self.freeButton setBackgroundColor:[UIColor redColor]];
    [self.freeButton addTarget:self action:@selector(freeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.freeButton];
    
    self.freeLabel =  [[UILabel alloc] initWithFrame:CGRectMake(20, 70, 100, 30)];
    self.freeLabel.text = @"测试中";
    self.freeLabel.backgroundColor = [UIColor greenColor];
    [self.view addSubview:self.freeLabel];
    

}

-(void)freeButtonAction:(UIButton *)sender
{
    selfdefineCalendarView *view = [[selfdefineCalendarView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    [view setMySelectDate:^(NSString *selecrString) {
        self.freeLabel.text= selecrString;
    }];
    
    [self.view addSubview:view];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
